package org.yelongframework.qrcode.impl.zxing;

import java.util.HashMap;
import java.util.Map;

import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;

/**
 * 二维码生成的属性配置
 * 
 * <pre>
 * ZxingEncodeQRCodeConfig encodeQRCodeConfig = new ZxingEncodeQRCodeConfig();
 * encodeQRCodeConfig.putHint(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);// 纠错能力
 * encodeQRCodeConfig.putHint(EncodeHintType.CHARACTER_SET, "UTF-8");// 编码
 * encodeQRCodeConfig.putHint(EncodeHintType.MARGIN, 1);// 内边距
 * </pre>
 * 
 * @since 1.0.0
 */
public final class ZxingEncodeQRCodeConfig {

	/**
	 * {@link Writer#encode(String, com.google.zxing.BarcodeFormat, int, int, Map)}的最后一个参数
	 */
	private final Map<EncodeHintType, Object> hints = new HashMap<>();

	/** 是否去除白边 */
	private boolean removeWhiteBorder = false;

	/** 外边距 */
	private int margin = 0;

	public ZxingEncodeQRCodeConfig() {
	}

	public void putHint(EncodeHintType key, Object value) {
		hints.put(key, value);
	}

	public Map<EncodeHintType, Object> getHints() {
		return hints;
	}

	public boolean isRemoveWhiteBorder() {
		return removeWhiteBorder;
	}

	public void setRemoveWhiteBorder(boolean removeWhiteBorder) {
		this.removeWhiteBorder = removeWhiteBorder;
	}

	public int getMargin() {
		return margin;
	}

	public void setMargin(int margin) {
		this.margin = margin;
	}

}
